<%--
  Created by IntelliJ IDEA.
  User: TiAmo
  Date: 2020/12/25
  Time: 15:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>增加或更新电子文档</title>
    <script src="../layui/layui.js"></script>
    <link rel="stylesheet" href="../layui/css/layui.css" media="all">
</head>
<body>
<h1 id="h1">
    <c:if test="${not empty entry.id}">
        增加电子文档
    </c:if>
    <c:if test="${empty entry.id}">
        更新电子文档
    </c:if>
</h1>
<form class="layui-form" action="/document/insert">
    <div class="layui-form-item">
        <label class="layui-form-label">文档名称(*)</label>
        <div class="layui-input-block">
            <input type="text" name="title" required  lay-verify="required" placeholder="请输入文档名称" autocomplete="off" class="layui-input"
                   value="${entry.title}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">文档摘要</label>
        <div class="layui-input-block">
            <input type="text" name="summary" required  lay-verify="required" placeholder="请输入文档摘要" autocomplete="off" class="layui-input"
                   value="${entry.summary}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">上传人</label>
        <div class="layui-input-block">
            <input type="text" name="uploaduser" required  lay-verify="required" placeholder="请输入上传人" autocomplete="off" class="layui-input"
                   value="${entry.uploaduser}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">上传时间(*)</label>
        <div class="layui-input-block">
            <input type="text" name="createdate" required  lay-verify="required" placeholder="请输入上传时间" autocomplete="off" class="layui-input"
                   value="${entry.createdate}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">文档分类</label>
        <div class="layui-input-block">
            <select name="categoryId" lay-verify="required">
                <c:forEach items="${listName}" var="category">
                    <option value="${category.id}">${category.name}</option>
                </c:forEach>
            </select>
        </div>
    </div>


    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

</body>
<script>
    //Demo
    layui.use('form', function(){
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function(data){
            layer.msg(JSON.stringify(data.field));
            return true;
        });
    });
</script>
</html>